package com.ruoyi.buss.grid.sq.controller;

import com.ruoyi.buss.grid.sq.domain.DataWgGridInfo;
import com.ruoyi.buss.grid.sq.service.DataWgGridInfoService;
import com.ruoyi.common.security.service.TokenService;
import com.ruoyi.system.api.model.LoginUser;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * (DataWgGridInfo)表控制层
 *
 * @author andy
 * @since 2022-05-24 16:37:18
 */
@RestController
@RequestMapping("/dataWgGridInfo")
public class DataWgGridInfoController {
    /**
     * 服务对象
     */
    @Autowired
    private DataWgGridInfoService dataWgGridInfoService;

    @Autowired
    private TokenService tokenService;

    /***
     * 根据机构号查询对应社区网格
     * @return
     */
    @GetMapping("/queryList")
    public List<DataWgGridInfo> queryList() {
        LoginUser userInfo = tokenService.getLoginUser();
        return this.dataWgGridInfoService.queryList(userInfo);
    }

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("{id}")
    public ResponseEntity<DataWgGridInfo> queryById(@PathVariable("id") Integer id) {
        return ResponseEntity.ok(this.dataWgGridInfoService.queryById(id));
    }


}

